//
//  def_statement.h
//  compilation
//
//  Created by Kevin Le perf on 17/01/12.
//  Copyright (c) 2012 e2co technologie. All rights reserved.
//

#ifndef compilation_def_statement_h
#define compilation_def_statement_h

/*
 statement
 : compound_statement {printf("statement\n");}
 | expression_statement  {printf("statement\n");}
 | selection_statement {printf("statement\n");}
 | iteration_statement {printf("statement\n");}
 | jump_statement {printf("statement\n");}
 ; 
 */

struct def_statement{
	void * parent;
	int type;
	struct def_compound_statement * compound_statement;
	struct def_expression_statement * expression_statement;
	struct def_selection_statement * selection_statement;
	struct def_iteration_statement * iteration_statement;
	struct def_jump_statement * jump_statement;
};

struct def_statement * statement_create(void * parent){
	struct def_statement * s = malloc(sizeof(*s));
	s->type = 0;
	s->parent = parent;
	return s;
}

void statement_print(struct def_statement * s){
	switch(s->type){
		case 1:
			compound_statement_print(s->compound_statement);
			break;
		case 2:
			expression_statement_print(s->expression_statement);
			break;
		case 3:
			selection_statement_print(s->selection_statement);
			break;
		case 4:
			iteration_statement_print(s->iteration_statement);
			break;
		case 5:
			jump_statement_print(s->jump_statement);
	}
}
#endif
